package main

import "fmt"

func main() {
	fmt.Println(findLengthOfLCIS([]int{1, 3, 5, 4, 7}))
}
func findLengthOfLCIS(nums []int) int {
	i, j := 0, 1
	maxLength := 0
	for ; j < len(nums); j++ {
		if nums[j] <= nums[j-1] {
			maxLength = max(maxLength, j-i)
			i = j
		}
	}

	// //这里不能是max(maxLength,j-1) j-1通常情况下与len(nums)-1效果相同，不过当nums为空时，两者结果不同，所以这里不能写j-i
	return max(maxLength, len(nums)-i)
}

func max(a, b int) int {
	if a > b {
		return a
	} else {
		return b
	}
}
